<script setup="">
import {defineEmits, onMounted, ref} from "vue"
import {useRouter} from "vue-router";
import {timeAgo} from "@/util/time.js";
import {ElMessage, ElMessageBox} from "element-plus";
import {adminDeleteTweet} from "@/request/mid_interface.js";
import NewOrEditTweet from "@/components/home/NewOrEditTweet.vue";
import EditFeedback from "@/components/feedback/EditFeedback.vue";

const emit = defineEmits([]);
const editData = ref({})
let props = defineProps({
  param: {
    type: Object,
    required: true
  }
})

onMounted(() => {
  initEditData()
})

function initEditData() {
  editData.value = props.param
}

function getTimeAgo(timestamp) {
  return timeAgo(timestamp)
}

function refresh() {
  dialogVisible.value = false
  emit('refresh')
}

const dialogVisible = ref(false)

</script>

<template>
  <div class="w-full bg-white px-5 py-4 pb-3 rounded-xl flex" style="">
    <el-dialog v-model="dialogVisible" width="800">
      <EditFeedback @close="dialogVisible=false" @refresh="refresh" :param="param"></EditFeedback>
    </el-dialog>
    <div class="flex-1 flex flex-col justify-between">
      <div class="text-black cursor-pointer">{{ param.title }}</div>
      <div class="cursor-pointer text-gray-400 mt-0.5">{{ param.content }}</div>
      <div class="flex justify-between mt-4">
        <div class="text-gray-400" style="font-size: 13px">{{ getTimeAgo(param.create_time * 1000) }} · <span class=""
                                                                                                              :style="{
          color:param.is_solved?'': 'var(--themeColor)',
        }">{{ param.is_solved ? "已处理" : "未处理" }}</span>
        </div>
        <div class="flex items-center">
          <img @click="dialogVisible=true" class="cursor-pointer select-none ml-2.5 w-6"
               src="@/assets/img/feedback_card/reply.svg" alt="">
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
</style>
